package org.benjamin.lending.service;

import org.benjamin.lending.domain.entity.BorrowInfo;
import org.benjamin.lending.domain.entity.BorrowProduct;
import org.benjamin.lending.domain.entity.BorrowTender;
import org.benjamin.lending.domain.entity.MemberInfo;
import org.benjamin.lending.form.TenderLogIndex;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by xywen on 2017/5/27.
 */
public interface BorrowService {

    /**
     * 投标检查是否已经开户等操作
     * @param memberInfo 用户对象
     * @return
     */
    boolean tenderCheck(MemberInfo memberInfo);

    boolean tenderCheck(String username);


    BorrowTender tenderSuccess(BorrowInfo borrowInfo, MemberInfo memberInfo, BigDecimal amount, boolean auto);

    Page<BorrowInfo> findBorrowInfoList(PageRequest pageRequest);

    Page<BorrowInfo> findBorrowInfoPage();
    
    /**
     * 获取所有的产品信息
     * @return 借款标产品信息对象
     */
    List<BorrowProduct> findProductList();

    void createBorrowInfo(BorrowInfo borrowInfo);

    BorrowInfo getBorrowById(Integer id);
    
    void updateEntity(BorrowInfo borrowInfo);

    /**
     * 审核操作
     * @param type 借款标的类型
     * @param message 审核备注
     * @param result 审核是否通过
     * @param borrowId 借款标编号
     * @param username 审核用户名
     */
	void auding(String type, String message, boolean result, Integer borrowId, String username);

	Page<BorrowTender> findUserTenderLogPage(TenderLogIndex tenderLogIndex);

    /**
     * 获取合同
     * @param borrowId 借款标编号
     * @return
     */
    byte[] contractDemand(Integer borrowId,String username,boolean createBuilder);

	void addProduct(BorrowProduct borrowProduct);
}
